package com.zhuangjie.order.controller;


import com.zhaungjie.base.conduit.R;
import com.zhuangjie.order.service.OrderDetailService;
import com.zhuangjie.security.annotations.NoAuthentication;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 订单明细表 前端控制器
 * </p>
 *
 * @author zhuangjie
 * @since 2023-11-24
 */
@RestController
@RequestMapping("/order-detail")
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailsService;

    @ApiOperation("获取店铺的所有菜品近n天的销量")
    @NoAuthentication
    @GetMapping("/shop-dish-sales-count")
    public R shopDishSalesCount(@RequestParam("shopId") Long shopId,@RequestParam("nDaysAgo") Integer nDaysAgo) {
        return R.require(orderDetailsService.getShopDishSalesCount(shopId,nDaysAgo));
    }

}

